package leesoft.gocrm.utils;

import java.io.UnsupportedEncodingException;
import java.util.logging.Logger;

import com.google.gdata.data.AbstractExtension;

public class TextUtils {
	public static boolean isNullOrEmpty(String str)
	{
		if(str==null || str.equals(""))
			return true;
		else
			return false;
	}
	public static String nullAsEmpty(String source)
	{
		return nullAsDefault(source,"");
	}
	public static String nullAsDefault(String source,String defaultValue)
	{
		return source==null?defaultValue:source;
	}
	public static String convertToUTF8(String org)
	{
		try
		{
			return new String(org.getBytes("ISO8859_1"), "UTF8");
		}catch(UnsupportedEncodingException e)
		{
			Logger.global.warning("The character can't be converted, may not be able to be rended right");
			return org;
		}
	}
	
}
